// ==UserScript==
// @name          Ikariam - Ally Page Editor
// @description   Version 1.0 - 
// @version       1.0
// @date          2008-10-22
// @namespace     archeorbiter.googlecode.com
// @include       http://s*.ikariam.tld/index.php?*
// @include       http://s*.ikariam.com.*/index.php?*
// @include       http://s*.*.ikariam.com/index.php?*
// @include       http://s*.ikariam.co.il/index.php?*
// ==/UserScript==


var page = document.getElementsByTagName('body')[0].id;

if (page == 'embassyExtern') {
	var textarea = document.getElementsByTagName('textarea')[0];
	textarea.id = 'nicEdit';
	
	var mainscript = document.createElement('script');
	mainscript.setAttribute('src', 'http://js.nicedit.com/nicEdit-latest.js');
	mainscript.type = 'text/javascript';

	var editor = document.createElement('script');
	editor.innerHTML = <><![CDATA[
    bkLib.onDomLoaded(
      function() {
        new nicEditor({
          buttonList : ['bold', 'italic', 'underline', 'left', 'center', 'right',
                        'justify', 'fontSize', 'fontFamily', 'fontFormat', 'ol',
                        'ul', 'indent', 'outdent', 'hr', 'forecolor', 'bgcolor',
                        'image', 'link', 'unlink', 'xhtml']
        }).panelInstance("nicEdit")
      }
    )
	]]></>;
	editor.type = 'text/javascript';

	var head = document.getElementsByTagName('head')[0];
	if (!head) { return; };
	head.appendChild(mainscript);
	head.appendChild(editor);
}


